<?php


namespace App\Model\CommodityModel;


use App\Model\BaseModel\BaseCommodityModel;

class StockInfoUser extends BaseCommodityModel
{
    public $table = 'stockinfouser_s2b';

    public function getStockUserByBidsAndIds($bid,$stock_ids)
    {
       $data=$this->where('BuID',$bid)->where('IsDisable',0)->whereIn('StockID',$stock_ids)->get()->toArray();
       if (!empty($data)){
           return array_column($data,NULL,'StockID');
       }
       return [];
    }

    /**
     * 查询用户下单商品是否有锁仓数据
     * @param string $BuID
     * @param string $stock_id
     */
    public function getStockInfoUserByBidAndStockID( string $BuID , string $stock_id )
    {
        return $this->info([
            'BuID'  => $BuID,
            'StockID' => $stock_id,
            'IsDisable' => 0
        ]);
    }
}